package team.seekers.oj.course.conventer;

import team.seekers.oj.common.converter.BaseConverter;
import team.seekers.oj.lesson.dto.ChapterListDTO;

import java.io.IOException;
import java.util.List;


@org.mapstruct.MapperConfig
public interface BaseCourseConverter<S, T> extends BaseConverter<S, T> {

    default List<Long> participantsTo(byte[] participants) {
        return CourseConvertUtils.participantsTo(participants);
    }

    default byte[] participantsFrom(List<Long> participants) {
        return CourseConvertUtils.participantsFrom(participants);
    }

    default List<ChapterListDTO> chaptersSectionsToChapterList(byte[] chaptersSections) throws IOException, ClassNotFoundException {
        return CourseConvertUtils.chaptersSectionsToChapterList(chaptersSections);
    }

    default byte[] chaptersSectionsFromChapterList(List<ChapterListDTO> chaptersSections) throws IOException, ClassNotFoundException {
        return CourseConvertUtils.chaptersSectionsFromChapterList(chaptersSections);
    }

}